#include <iostream>
#include <vector>
using namespace std;

int main() {
    vector<long long> dp(21, 0);
    dp[2] = 1;
    for (int i = 3; i < dp.size(); ++i)
        dp[i] = (i - 1) * (dp[i - 1] + dp[i - 2]);
    int n = 0;
    while (cin >> n)
    {
        cout << dp[n] << endl;
    }
}